<div [@routerTransition]>
    <h1>订单列表</h1>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped table-bordered table-hover table-condensed">
                <thead>
                    <tr>
                        <td>序号</td>
                        <td>*</td>
                        <th>商品名称</th>
                        <th>店长</th>
                        <th>用户</th>
                        <th>下单时间</th>
                        <th>状态</th>
                        <th>成交价</th>
                        <th>店长收益</th>
                        <th>帮惠收益</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let order of orderList.items">
                        <td>{{order.id}}</td>
                        <td class="thumbnail">
                            <img *ngIf="order.headerImageId" [src]="downloadUrl+order.headerImageId" alt="">
                            <img *ngIf="!order.headerImageId" src="../../../assets/app-logo-small.png" alt="">
                        </td>
                        <td>{{order.productName}}</td>
                        <td>{{order.agentUserName}}</td>
                        <td>{{order.phoneNumber}}</td>
                        <td>{{order.orderTime|date:'yyyy-MM-dd HH:mm:ss'}}</td>
                        <td>{{order.isPayed?"是":"否"}}</td>
                        <td>{{order.price}}</td>
                        <td>{{order.agentProfit}}</td>
                        <td>{{order.systemProfit}}</td>
                        <td>
                            <div class="btn-group" dropdown>
                                <button dropdownToggle type="button" class="btn btn-sm btn-primary dropdown-toggle">
    操作 <span class="caret"></span>
  </button>
                                <ul *dropdownMenu class="dropdown-menu" role="menu">
                                    <li role="menuitem" *ngIf="!order.isDelivered">
                                        <a class="dropdown-item" (click)="orderDeliver(order.id)">发货</a>
                                    </li>
                                    <li role="menuitem">
                                        <a class="dropdown-item" (click)="showDetail(order.id)">查看详情</a>
                                    </li>
                                    <li class="divider dropdown-divider"></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>

            <div class="row">
                <div class="col-md-12 pull-right">
                    <pagination [boundaryLinks]="true" [maxSize]="5" [totalItems]="orderList?.totalCount" [(ngModel)]="currentPage" class="pagination-sm" [boundaryLinks]="true" [rotate]="false" previousText="&lsaquo;" nextText="&rsaquo;" firstText="&laquo;" lastText="&raquo;"
                        (pageChanged)="pageChanged($event)"></pagination>
                </div>
            </div>
        </div>
    </div>
</div>
<app-order-detail #orderDetailModal></app-order-detail>